home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20000114-20000217 / 000123_news@columbia.edu _Sun Jan 23 19:57:18 2000.msg < prev    next >
Internet Message Format  |  2020-01-01  |  9KB

  1. Return-Path: <news@columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id TAA27636
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Sun, 23 Jan 2000 19:57:18 -0500 (EST)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id TAA19711
  7.     for kermit.misc@watsun.cc.columbia.edu; Sun, 23 Jan 2000 19:28:34 -0500 (EST)
  8. X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Subject: Case Study #14: Character Sets
  11. Date: 24 Jan 2000 00:28:33 GMT
  12. Organization: Columbia University
  13. Message-ID: <86g6bh$j7s$1@newsmaster.cc.columbia.edu>
  14. To: kermit.misc@columbia.edu
  15.  
  16.  
  17. Some recent questions about character-sets prompt today's discussion.  As
  18. you probably know, Kermit software is practically (and perhaps actually)
  19. unique among communication software packages in its ability to convert the
  20. character sets of text files while transferring them between platforms that
  21. use different ones.  In the recent postings, the need was to transfer
  22. Portuguese text between a PC that used PC Code Page 850 (CP850) and a UNIX
  23. system that used some other encoding.
  24.  
  25. Kermit protocol and software have been able to handle such tasks since the
  26. 1980s.  This feature is important to everybody who reads and writes a
  27. language that uses accented and/or non-Roman characters -- in other words,
  28. the overwhelming majority of humanity.  Only a few languages are written
  29. entirely in plain ABCs: English, Latin, Malay, and maybe Dutch.  Nearly all
  30. the others need accents or non-ABC characters.  But accented and non-Roman
  31. characters are represented differently on different computers.  So
  32. (returning to our example) if you copy Portuguese text from (say) DOS or
  33. Windows to (say) HP-UX or VMS, all the accented letters become, well,
  34. garbage.  If you copy Greek, Russian, or Hebrew text between the same two
  35. computers, ALL the letters become garbage.
  36.  
  37. What good is accomplished by moving text from one computer to another if the
  38. result is gibberish?  In the world at large, text-file transfer should
  39. provide for character-set conversion.  The Kermit protocol does; the method
  40. was worked out in the late 1980s and is written up in papers you can find
  41. at:
  42.  
  43.   http://www.columbia.edu/kermit/papers.html
  44.  
  45. Suppose you want to send Portuguese text from DOS to HP-UX (in DOS,
  46. Portuguese text can be encoded in CP437, CP850, or CP860, each of them
  47. different; your first job is to find out which one is actually used on your
  48. PC).  Let's say the encoding is CP850.  You would tell Kermit on the PC to:
  49.  
  50.   set file character-set cp850
  51.  
  52. Use C-Kermit's menu-on-demand feature to find out what file character-sets
  53. are available:
  54.  
  55.   set file character-set ?
  56.  
  57. This gives you the complete list.
  58.  
  59. But PC Kermit doesn't send CP850 on the wire, because it's a private
  60. (proprietary) character set.  Only standard character sets should be used
  61. between computers.  Kermit supports a small number of standard transfer
  62. character-sets, each one covering its own group of languages (and therefore
  63. file character-sets).  You have to tell it which one to use; in this case,
  64. ISO 8859-1 Latin Alphabet 1:
  65.  
  66.   set transfer character-set latin1
  67.  
  68. You can see the list of available transfer character-sets with:
  69.  
  70.   set transfer character-set ?
  71.  
  72. (If you obtained the two lists, you should have seen about 50 file
  73. character-sets and 10 transfer character-sets, enough to cover the West and
  74. East European Roman-alphabet languages, plus languages written in Cyrillic
  75. and Hebrew, plus Greek and Japanese.)
  76.  
  77. Now when PC Kermit sends a file in text mode, it converts the file from
  78. CP850 to Latin-1, and announces the Latin-1 encoding to the receiving
  79. Kermit program.
  80.  
  81. Meanwhile, because the HP-Roman8 character set is used on HP-UX, which is
  82. different not only from the PC code pages just mentioned but also from
  83. Latin-1, HP-UX C-Kermit must be told to:
  84.  
  85.   set file character-set hp-roman8
  86.  
  87. The final step is to make sure the file sender transfers the file in text
  88. mode, rather than binary mode, because character-set and record-format
  89. conversions take place only in text mode:
  90.  
  91.   set file type text
  92.  
  93. Now the file can be transferred.  To summarize, the following commands are
  94. given to the file sender:
  95.  
  96.   set file character-set cp850       ; Identify the source file encoding
  97.   set transfer character-set latin1  ; Specify the transfer encoding
  98.   set file type text                 ; Choose text mode
  99.   send quilombo.txt                  ; Send a file
  100.  
  101. and to the file receiver:
  102.  
  103.   set file character-set hp-roman8   ; Identify target file encoding
  104.   receive                            ; Receive the file
  105.  
  106. The file sender tells the file receiver to expect a text file encoded in
  107. Latin-1; the file sender converts from CP850 to Latin-1, and the file
  108. receiver converts from Latin-1 to HP-Roman8.  To send files in the other
  109. direction, simply exchange the SEND and RECEIVE commands (keeping the
  110. SET FILE TYPE TEXT command with the file sender); the rest stays the same.
  111.  
  112. This is all old news, but it might still be new to many readers.  The
  113. procedures and specific character sets are documented in Chapter 16 of
  114. "Using C-Kermit", 2nd Edition, and in other Kermit manuals.  All of the
  115. facilities discussed until now are found in C-Kermit 5A and later, MS-DOS
  116. Kermit 3.0 and later, Kermit 95 (all versions), and IBM Mainframe Kermit
  117. since (I think) version 4.1.
  118.  
  119. So what's new in C-Kermit 7.0 and the forthcoming 1.1.18 release of Kermit
  120. 95?  Lots of new character sets have been added, including many for Eastern
  121. Europe and the former Soviet Union, as well as those used for Greek.  And
  122. Unicode, the new Univeral Character Set, which was discussed in a previous
  123. posting.  So now the possibilities for character-set conversion are wider
  124. than ever.
  125.  
  126. And in keeping with our goal that C-Kermit 7.0 "just work" for most people
  127. most of the time, we have also added not just automatic text/binary mode
  128. switching, discussed previously, but also automatic character-set
  129. associations, in which each file character-set is associated with an
  130. appropriate transfer character-set, and vice versa.  C-Kermit comes with a
  131. comprehensive table of associates preloaded, which you can view with:
  132.  
  133.   show associations
  134.  
  135. Perhaps you were wondering (if you don't have a manual) how you were
  136. supposed to know that Latin-1 was the appropriate transfer character-set for
  137. CP850?  Good question!  Now this information is built in to C-Kermit.  So
  138. whenever you pick a file character-set, C-Kermit picks the appropriate
  139. transfer character-set for you, and vice versa.  Furthermore, whenever
  140. C-Kermit receives a text file in a particular transfer character-set, it
  141. converts it to the appropriate file character-set automatically, even if you
  142. have not told it which one to use.  So the sequence above is now simplified.
  143. At the sender:
  144.  
  145.   set file character-set cp850       ; Identify the source file encoding
  146.   send *.*                           ; Send some files
  147.  
  148. and at the file receiver:
  149.  
  150.   receive                            ; Receive the file
  151.  
  152. Appropriate associations are built in for each platform.  So you just have
  153. to start the ball rolling by specifying the encoding of the source file; the
  154. rest flows from there.  And now because of automatic text/binary mode
  155. switching, you can send a mixed group of text and binary files and have the
  156. character-set conversions applied only to the text files.
  157.  
  158. Of course you can change associations if you need to.  The command is
  159. ASSOCIATE.  You can also turn this whole feature on and off with SET SEND
  160. (and RECEIVE) CHARACTER-SET-SELECTION.  For complete details about
  161. character-set associations, see Section 6.5 of the ckermit2.txt file.
  162.  
  163. So now C-Kermit is just about as automatic as it can be in this area.  The
  164. one thing it can't do is figure out automatically the encoding of a file.
  165. Some people believe this can be done, but I'm not one of them.  Operating
  166. systems have nevere tagged files by encoding, and guessing the encoding from
  167. inspection is highly unreliable.
  168.  
  169. By the way, C-Kermit's character-set conversion capabilities are not limited
  170. to file transfer.  They are also available in terminal (CONNECT) mode.  In
  171. this case you choose the translation with:
  172.  
  173.   set terminal character-set <remote-set> [ <local-set> ]
  174.  
  175. The <local-set> defaults to C-Kermit's current file character-set.  Again,
  176. type a question mark in the character-set field to get a list of available
  177. choices.
  178.  
  179. Finally, you can also use C-Kermit to convert a local file from one
  180. character-set to another.  For example, to convert the file oofa.txt from
  181. Latin-1 to the UTF-8 form of Unicode, and store the result as oofa.utf8,
  182. the command would be:
  183.  
  184.   translate oofa.txt latin1 utf8 oofa.utf8
  185.  
  186. This is nothing new, except for the expanded character-set choices.
  187.  
  188. - Frank